set(CPACK_PACKAGE_NAME "demo03")  # 声明包名称
set(CPACK_PACKAGE_VENDOR "test")  # 声明包提供者
set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/Readme.md")  # 包含包描述文件
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "test cpack")  # 添加包描述信息
# set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")

set(CPACK_PACKAGING_INSTALL_PREFIX "")  # 指定安装包解压后的目录前缀，适用于二进制打包
# 当前打包为demo03-Source.tar.gz, 解压后为demo03/prefix/code_file...

set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")

set(CPACK_SOURCE_IGNORE_FILES
  "${PROJECT_BINARY_DIR}"
  .git/
  .gitignore
)
set(CPACK_SOURCE_GENERATOR "TGZ")  # 声明源码的打包生成器 ZIP: .ZIP, TGZ:.tar.gz

include(CPack)
